package com.example.loginproject.view.fragments

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.example.loginproject.BlankFragment
import com.example.loginproject.R
import com.example.loginproject.databinding.FragmentPatternLoginBinding
import com.example.loginproject.tool.navigateTo

/**
 * A simple [Fragment] subclass.
 * Use the [PatternLoginFragment.newInstance] factory method to
 * create an instance of this fragment.
 */
class PatternLoginFragment : Fragment() {

private lateinit var binding:FragmentPatternLoginBinding
    private var shouldStart = true
    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        binding = FragmentPatternLoginBinding.inflate(inflater,container,false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        binding.waveAnimationView.addClickListener {
            it.startAnimation()
        }
        binding.waveAnimationView.addClickListener {
            if (shouldStart){
            it.startAnimation()
        }else{
            it.pauseAnimation()
        }
        shouldStart = !shouldStart
    }
        binding.textView2.setOnClickListener {
            navigateTo(BlankFragment())
        }
    }
}